<?php

namespace app\common\validate;

use think\Validate;

class User extends Validate
{
    protected $rule = [
        "mobile" => "require|mobile", //前端账号密码登录
        "login_account" => "require",
        "account" => "require|mobile|unique:member",
        "password" => "require",
        "repassword" => "require|confirm:password",
        "name" => "require",
        'attest_name' => "require",
        'attest_sex' => "require",
        'attest_birthday' => "require",
        'attest_card_num' => "require",
        'attest_phone' => "require|mobile",
        'attest_card_just' => "require",
        'attest_card_back' => "require",
        'code' => "require",
        'time' => "require",
        'codestr' => "require",
    ];

    protected $message = [
        "mobile.require" => "请输入账号",           //前端账号密码登录
        "mobile.mobile" => "手机号码格式错误",      //前端账号密码登录
        "login_account.require" => "请输入账号",
        "account.require" => "请输入账号",
        "account.mobile" => "账号必须是手机号码",
        "account.unique" => "这个手机号码已经被用过了",
        "password.require" => "请输入密码",
        "repassword.require" => "请重复确认密码",
        "repassword.confirm" => "两次输入的密码不一致",
        "name.require" => "请输入姓名",

        'attest_name' => "请填写真实姓名",
        'attest_sex' => "请选择您的性别",
        'attest_birthday' => "请填写出生日期",
        'attest_card_num' => "请填写身份证号码",
        'attest_phone' => "请填写认证手机号",
        "attest_phone.mobile" => "请输入正确的手机号码",
        'attest_card_just' => "请上传身份证正面",
        'attest_card_back' => "请上传身份证反面",

        'code' => "请输入验证码",
        'time' => "没有获取到时间戳",
        'codestr' => "没有获取到加密字符串",
    ];

    protected $scene = [
        'update_password' => ['password', 'repassword'],
        'login' => ['login_account', 'password'],
        'mobile_password_login' => ['mobile', 'password'], //前端账号密码登录
        'mobile' => ['mobile'], //手机一键登录
        'sms_login' => ['mobile', 'code'], //验证码登录 
        'account' => ['account', 'code', 'time', 'codestr'], //改绑手机号
        'add_member' => ['account', 'password', 'repassword', 'name', 'level'], //后台添加会员
        'edit_member' => ['name', 'level'], //后台修改会员
        'attest' => ['attest_name', 'attest_sex', 'attest_birthday', 'attest_card_num', 'attest_phone', 'attest_card_just', 'attest_card_back'], //后台添加会员
    ];
}
